<template>
<div>
  <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      @select="handleSelect"

  >
    <el-menu-item :index="i.id" v-for="i in list" :key="i">{{i.name}}</el-menu-item>
    <el-button type="info" style="width: 100px;height: 58px" @click="ns">退出登录</el-button>
  </el-menu>
</div>
  <div v-if="this.num=='2'">
    <el-tabs :tab-position="tabPosition" style="height: 200px;">
      <el-tab-pane label="借款审核">
        <el-table
            :data="dict"
            stripe
            style="width: 100%">
          <el-table-column
              prop="name"
              label="借款名称">
          </el-table-column>
          <el-table-column
              prop="total_money"
              label="姓名"
          >
          </el-table-column>
          <el-table-column
              prop="need_money"
              label="已筹资金"
          >
          </el-table-column>
          <el-table-column
              prop="status"
              label="满标">
          </el-table-column>
          <el-table-column
              prop="repay_time"
              label="还款期限(月)">
          </el-table-column>
          <el-table-column
              prop="use1"
              label="借款用途	">
          </el-table-column>
          <el-table-column
              prop="interest_rate"
              label="利息">
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template  v-slot="scope">
              <el-button type="text" size="small" @click="handleClick(scope.row.id)"
              >通过</el-button
              >
              <el-button type="text" size="small" @click="refuse(scope.row.id)">拒绝</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="满标审核">
        <full_bid></full_bid>
      </el-tab-pane>
      <el-tab-pane label="催收收款">
        <collection_user></collection_user>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>


import full_bid from "@/background/full_bid";
import collection_user from "@/background/collection_user";

export default {

name: "back-end_homepage",
  data(){
  return{
    activeIndex2: '1',
    num:'',
    list:[],
    tabPosition: 'left',
    dict:[]
  }
  },
  components:{
    full_bid:full_bid,
  collection_user:collection_user
  },
  methods:{
    refuse(row){
      this.$confirm('确定审核拒绝, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '拒绝成功!'
        });
        this.myaxios('http://localhost:5000/markaudit','get',{
          'markid':row,
          'status':9
        }).then(res=>{
          console.log(res)

        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消通过'
        });
      });
    },
    // 表单审核通过
    handleClick(row) {
      this.$confirm('确定审核通过, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '通过成功!'
        });
        this.myaxios('http://localhost:5000/markaudit','get',{
          'markid':row,
          'status':2
        }).then(res=>{
          console.log(res)

        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消通过'
        });
      });
    },
    ns(){
      console.log('51515')
      localStorage.removeItem('usrid')
      localStorage.removeItem('username')
      window.location.href='/Administrator_login'
    },

    get_marklist(){
      this.myaxios('http://localhost:5000/marklist','get',{'nuid':1}).then(res=>{
        console.log(res)
       this.dict=res.list

      })
    },
    handleSelect(key, keyPath) {
      this.num=key
      console.log(this.num)
      console.log(key, keyPath);
    },get_rose(){
      this.myaxios('http://localhost:5000/background_resurce','get',{'uid':localStorage.getItem('usrid')}).then(res=>{
        console.log(res)
        this.list=res.list
      })
    }
  },
  mounted() {
  this.get_rose()
  this.get_marklist()
  }
}
</script>

<style scoped>

</style>
